package study.java.jdk.jdk8._5_lambda.apple;

import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

@Slf4j
public class Apple_Test {

    private List<Apple> dataLt;

    @Before
    public void init() {
        Apple a1 = new Apple().setColor("red").setWeight(50);
        Apple a2 = new Apple().setColor("red").setWeight(100);
        Apple a3 = new Apple().setColor("blue").setWeight(80);
        dataLt = Arrays.asList(a1, a2, a3);
    }

    @Test
    public void test1() {
        List<Apple> destLt = AppleUtils.filterByColor(dataLt, "blue");
        log.info(">>>>>> {}", destLt);
    }

    @Test
    public void test3() {
        List<Apple> destLt = AppleUtils.filter(dataLt, e -> "red".equals(e.getColor()));
        log.info(">>>>>> {}", destLt);
    }
}
